function BaseEnermyFly(isBoss){
    this.width = 0;
    this.height = 0;

    this.MapLeft = 0;
    this.MapTop = 0;
    this.MapRight = 0;
    this.MapBottom = 0;

    this.speedX = 0;
    this.speedY = 0;
    this.posX = 0;
    this.posY = 0;
    this.lastPosX = 0;
    this.lastPosY = 0;
    this.usable = false;
    this.visible = false;
    this.isHurted = false;
    this.imgs = new Array();
    this.blood = 0;
    this.fullBlood = 0;
    this.showBlood = false;
    this.showBloodCount = 0;
    this.fightCount = 0;//攻击间隔
    this.fightTotal = 0;
    this.startFight = false;
    this.bulletAttack = 0;
    this.isBoss = isBoss;
    this.defeatScore = 0;
}

BaseEnermyFly.prototype.draw = function(graphic){
    if(this.visible){
        if(this.isHurted){
            graphic.drawImage(this.imgs[1], this.posX, this.posY);
            this.isHurted = false;
        }
        else{
            graphic.drawImage(this.imgs[0], this.posX, this.posY);
        }
        if(this.showBlood){
            graphic.fillStyle = "#ff0000";
            graphic.fillRect(this.posX, this.posY+this.height+3, (this.blood/this.fullBlood)*this.width,5);
            graphic.strokeStyle = "#0000ff";
            graphic.strokeRect(this.posX, this.posY+this.height+3, this.width,5);
        }
    }
}

BaseEnermyFly.prototype.beenHurt = function(hurt){
    this.isHurted = true;
    this.blood = this.blood - hurt;
    this.showBlood = true;
    this.showBloodCount = 0;
    if(this.blood <= 0){
        this.usable = false;
        this.visible = false;
        defeatOneEnermy(this.posX+this.width/2, this.posY+this.height/2, this.isBoss, this.defeatScore);
    }
}

BaseEnermyFly.prototype.checkShowBlood = function(){
    if(this.showBlood){
        this.showBloodCount++;
        if(this.showBloodCount>15){
            this.showBlood = false;
            this.showBloodCount = 0;
        }
    }
}

//BaseEnermyFly.prototype.initPlane = function (width, height, MapRight, MapBottom, speedX, speedY, posX, posY, img1, img2, blood) {
//    this.width = width;
//    this.height = height;
//    this.MapLeft = -width;
//    this.MapTop = -height;
//    this.MapRight = MapRight;
//    this.MapBottom = MapBottom;
//    this.speedX = speedX;
//    this.speedY = speedY;
//    this.posX = posX;
//    this.posY = posY;
//    this.lastPosX = posX;
//    this.lastPosY = posY;
//    this.usable = true;
//    this.visible = false;
//    this.isHurted = false;
//    this.imgs.splice(0,this.imgs.length);
//    this.imgs.push(img1);
//    this.imgs.push(img2);
//    this.blood = blood;
//    this.fullBlood = blood;
//    this.fightCount = 0;
//};

//第一类飞机到达指定位置后开始攻击
function EnermyFly_1(){
    BaseEnermyFly.call(this,false);
    this.hasArriveTarget = false;
    this.targetY = 0;
    this.moveMethod = null;
    this.fightMethod = null;
}
inheritPrototype(EnermyFly_1, BaseEnermyFly);

EnermyFly_1.prototype.initPlane = function (width, height, MapRight, MapBottom, speedX, speedY, posX, posY, img1, img2, blood, targetY, moveType, fightType, fightTotal, baseBulletSpeed, bulletAttack, defeatScore) {
    this.width = width;
    this.height = height;
    this.MapLeft = -width;
    this.MapTop = -height;
    this.MapRight = MapRight;
    this.MapBottom = MapBottom;
    this.speedX = speedX;
    this.speedY = speedY;
    this.posX = posX;
    this.posY = posY;
    this.lastPosX = posX;
    this.lastPosY = posY;
    this.usable = true;
    this.visible = false;
    this.isHurted = false;
//    this.imgs.splice(0,this.imgs.length);
    this.imgs.push(img1);
    this.imgs.push(img2);
    this.blood = blood;
    this.fullBlood = blood;
    this.fightCount = 0;
    this.startFight = false;

    this.hasArriveTarget = false;
    this.targetY = targetY;

    this.fightTotal = fightTotal;
    this.bulletAttack = bulletAttack;

    this.defeatScore = defeatScore;

    switch(moveType){
        case 0:
            //到达位置后加速
            this.moveMethod = function(){
                this.speedY = this.speedY*2;
            }
            break;

        case 1:
            //到达位置后原地不动
            this.moveMethod = function(){
                this.speedY = 0;
            }
            break;

        case 2:
            //到达位置后往x轴消失
            this.moveMethod = function(){
                var tempX = this.MapRight - this.width>>1;
                if(this.posX < tempX){
                    this.speedX = this.speedY/2;
                }
                else if(this.posX > tempX){
                    this.speedX = -this.speedY/2;
                }
            }
            break;

        case 3:
            //到达位置后不变化
            this.moveMethod = function(){}
            break;
    }

    switch(fightType){
        case 0:
            //不放子弹
            this.fightMethod = function(){}
            break;

        case 1:
            //指向：发射1颗
            this.fightMethod = function(){
                var enermyCenterPX = this.posX+this.width/2;
                var enermyCenterPY = this.posY+this.height/2;
                var speedArray = getDirectSpeedXY(myPlane.PlaneX+myPlane.PlaneWidth/2, myPlane.PlaneY+myPlane.PlaneHeight/2, enermyCenterPX, enermyCenterPY, baseBulletSpeed);
                initOneBullet(speedArray[0], speedArray[1], enermyCenterPX, enermyCenterPY, 0, this.bulletAttack);
            }
            break;

        case 2:
            //指向：发射2颗
            this.fightMethod = function(){
                var enermyCenterPX = this.posX+this.width/2;
                var enermyCenterPY = this.posY+this.height/2;
                var speedArray = getDirectSpeedXY(myPlane.PlaneX+myPlane.PlaneWidth/2, myPlane.PlaneY+myPlane.PlaneHeight/2, enermyCenterPX, enermyCenterPY, baseBulletSpeed);
                initOneBullet(speedArray[0], speedArray[1], enermyCenterPX, enermyCenterPY, 0, this.bulletAttack);
                initOneBullet(speedArray[0]+randomNextInt(1,2), speedArray[1]+randomNextInt(1,2), enermyCenterPX, enermyCenterPY, 0, this.bulletAttack);
            }
            break;

        case 3:
            //指向：发射4颗
            this.fightMethod = function(){
                var enermyCenterPX = this.posX+this.width/2;
                var enermyCenterPY = this.posY+this.height/2;
                var speedArray = getDirectSpeedXY(myPlane.PlaneX+myPlane.PlaneWidth/2, myPlane.PlaneY+myPlane.PlaneHeight/2, enermyCenterPX, enermyCenterPY, baseBulletSpeed);
                initOneBullet(speedArray[0], speedArray[1], enermyCenterPX, enermyCenterPY, 0, this.bulletAttack);
                initOneBullet(speedArray[0]+1, speedArray[1], enermyCenterPX, enermyCenterPY+5, 0, this.bulletAttack);
                initOneBullet(speedArray[0]+2, speedArray[1], enermyCenterPX, enermyCenterPY+10, 0, this.bulletAttack);
                initOneBullet(speedArray[0]+3, speedArray[1], enermyCenterPX, enermyCenterPY+15, 0, this.bulletAttack);
            }
            break;

        case 4:
            //规则：向下发射2颗
            this.fightMethod = function(){
                var enermyCenterPX = this.posX+this.width/2;
                var enermyCenterPY = this.posY+this.height/2;
                initOneBullet(2, baseBulletSpeed, enermyCenterPX+10, enermyCenterPY, 1, this.bulletAttack);//右
                initOneBullet(-2, baseBulletSpeed, enermyCenterPX-10, enermyCenterPY, 1, this.bulletAttack);//左
            }
//            //向上射子弹
//            this.fightTotal = 4;
//            this.fightMethod = function(){
//                initOneBullet(4, -4, this.posX+25, this.posY, 0);//右
//                initOneBullet(-4, -4, this.posX+25-24, this.posY, 0);//左
//            }
            break;

        case 5:
            //规则：向下发射3颗
            this.fightMethod = function(){
                var enermyCenterPX = this.posX+this.width/2;
                var enermyCenterPY = this.posY+this.height/2;
                initOneBullet(2, baseBulletSpeed, enermyCenterPX+10, enermyCenterPY, 1, this.bulletAttack);//右
                initOneBullet(-2, baseBulletSpeed, enermyCenterPX-10, enermyCenterPY, 1, this.bulletAttack);//左
                initOneBullet(0, baseBulletSpeed+2, enermyCenterPX, enermyCenterPY, 1, this.bulletAttack);//中
            }
            break;

        case 6:
            //规则：向下发射4颗
            this.fightMethod = function(){
                var enermyCenterPX = this.posX+this.width/2;
                var enermyCenterPY = this.posY+this.height/2;
                initOneBullet(2, baseBulletSpeed*7/10, enermyCenterPX+10, enermyCenterPY, 1, this.bulletAttack);//右
                initOneBullet(1, baseBulletSpeed, enermyCenterPX+5, enermyCenterPY, 1, this.bulletAttack);//右
                initOneBullet(-2, baseBulletSpeed*7/10, enermyCenterPX-10, enermyCenterPY, 1, this.bulletAttack);//左
                initOneBullet(-1, baseBulletSpeed, enermyCenterPX-5, enermyCenterPY, 1, this.bulletAttack);//左
            }
            break;

        case 7:
            //规则：向上发射2颗
            this.fightMethod = function(){
                var enermyCenterPX = this.posX+this.width/2;
                var enermyCenterPY = this.posY+this.height/2;
                initOneBullet(4, -baseBulletSpeed, enermyCenterPX+10, enermyCenterPY, 1, this.bulletAttack);//右
                initOneBullet(-4, -baseBulletSpeed, enermyCenterPX-10, enermyCenterPY, 1, this.bulletAttack);//左
            }
            break;

        case 8:
            //规则：向上发射3颗
            this.fightMethod = function(){
                var enermyCenterPX = this.posX+this.width/2;
                var enermyCenterPY = this.posY+this.height/2;
                initOneBullet(4, -baseBulletSpeed, enermyCenterPX+10, enermyCenterPY, 1, this.bulletAttack);//右
                initOneBullet(-4, -baseBulletSpeed, enermyCenterPX-10, enermyCenterPY, 1, this.bulletAttack);//左
                initOneBullet(0, -baseBulletSpeed+2, enermyCenterPX, enermyCenterPY, 1, this.bulletAttack);//中
            }
            break;

        case 9:
            //规则：向上发射4颗
            this.fightMethod = function(){
                var enermyCenterPX = this.posX+this.width/2;
                var enermyCenterPY = this.posY+this.height/2;
                initOneBullet(4, -baseBulletSpeed*7/10, enermyCenterPX+10, enermyCenterPY, 1, this.bulletAttack);//右
                initOneBullet(2, -baseBulletSpeed, enermyCenterPX+5, enermyCenterPY, 1, this.bulletAttack);//右
                initOneBullet(-4, -baseBulletSpeed*7/10, enermyCenterPX-10, enermyCenterPY, 1, this.bulletAttack);//左
                initOneBullet(-2, -baseBulletSpeed, enermyCenterPX-5, enermyCenterPY, 1, this.bulletAttack);//左
            }
            break;
    }
};
EnermyFly_1.prototype.update = function(){
    if(this.usable){
        //更新位置
        this.lastPosX = this.posX;
        this.lastPosY = this.posY;
        this.posX = this.posX + this.speedX;
        this.posY = this.posY + this.speedY;
        if(this.lastPosY <= this.MapTop && this.posY >= this.MapTop){
            this.visible = true;
        }
        if(this.lastPosY > this.MapBottom && this.posY > this.MapBottom){
            this.usable = false;
            this.visible = false;
        }
        //血量显示
//        if(this.showBlood){
//            this.showBloodCount++;
//            if(this.showBloodCount>10){
//                this.showBlood = false;
//                this.showBloodCount = 0;
//            }
//        }
        this.checkShowBlood();

        //运动方式
        if(!this.hasArriveTarget){
            if(this.posY>=this.targetY){
                this.hasArriveTarget = true;
                this.startFight = true;
                this.fightMethod();

                this.moveMethod();
            }
        }
        //攻击方式
        if(this.startFight){
            this.fightCount++;
            if(this.fightCount ==  this.fightTotal){
                this.fightCount = 0;

                this.fightMethod();
            }
        }
    }
}


//boos1
function EnermyFly_Boss1(){
    BaseEnermyFly.call(this,true);
    this.hasArriveTarget = false;
    this.directionState = 0;
    this.targetY = 0;
    this.moveMethod = null;
    this.fightMethod = null;
    this.currentFightIndex = 0;
    this.FightTypeTotal = 0;
}
inheritPrototype(EnermyFly_Boss1, BaseEnermyFly);

EnermyFly_Boss1.prototype.initPlane = function (width, height, MapRight, MapBottom, speedX, speedY, posX, posY, img1, img2, blood, targetY, baseBulletSpeed, bulletAttack, bossType, bossLevel, defeatScore) {
    this.width = width;
    this.height = height;
    this.MapLeft = -width;
    this.MapTop = -height;
    this.MapRight = MapRight;
    this.MapBottom = MapBottom;
    this.speedX = speedX;
    this.speedY = speedY;
    this.posX = posX;
    this.posY = posY;
    this.lastPosX = posX;
    this.lastPosY = posY;
    this.usable = true;
    this.visible = false;
    this.isHurted = false;
//    this.imgs.splice(0,this.imgs.length);
    this.imgs.push(img1);
    this.imgs.push(img2);
    this.blood = blood;
    this.fullBlood = blood;
    this.fightCount = 0;
    this.startFight = false;
    this.bulletAttack = bulletAttack;

    this.defeatScore = defeatScore;

    this.hasArriveTarget = false;
    this.targetY = targetY;
    this.directionState = 0;

    var moveType = randomNextInt(0,2);

    switch(moveType){
        case 0:
            //到达位置后x，y轴摆动
            this.moveMethod = function(){
                this.lastPosX = this.posX;
                this.lastPosY = this.posY;
                if(this.directionState == 0){
                    this.posX = this.posX-2;
                    this.posY = this.posY+1;
                    if(this.posX<=50){
                        this.directionState = 1;
                    }
                }
                else if(this.directionState == 1){
                    this.posX = this.posX+2;
                    this.posY = this.posY+1;
                    if(this.posX >= 106){
                        this.directionState = 2;
                    }
                }
                else if(this.directionState == 2){
                    this.posX = this.posX+2;
                    this.posY = this.posY-1;
                    if(this.posX >= 162){
                        this.directionState = 3;
                    }
                }
                else if(this.directionState == 3){
                    this.posX = this.posX-2;
                    this.posY = this.posY-1;
                    if(this.posX <= 106){
                        this.directionState = 0;
                    }
                }
            }
            break;

        case 1:
            //到达位置后原地不动
            this.moveMethod = function(){
                this.speedY = 0;
            }
            break;

        case 2:
            //到达位置后x轴摆动
            this.moveMethod = function(){
                this.lastPosX = this.posX;
                this.lastPosY = this.posY;
                if(this.directionState == 0){
                    this.posX = this.posX-2;
                    if(this.posX<=50){
                        this.directionState = 1;
                    }
                }
                else if(this.directionState == 1){
                    this.posX = this.posX+2;
                    if(this.posX >= 162){
                        this.directionState = 0;
                    }
                }
            }
            break;
    }

    this.currentFightIndex = 0;
    switch(bossType){
        case 0:
            switch(bossLevel){
                case 1:
                    this.fightTotal = 15;
                    this.FightTypeTotal = 2;
                    break;

                case 2:
                    this.fightTotal = 10;
                    this.FightTypeTotal = 3;
                    break;

                case 3:
                default:
                    this.fightTotal = 6;
                    this.FightTypeTotal = 4;
                    break;
            }

            this.fightMethod = function(){
                switch(this.currentFightIndex){
                    case 0:
                        var enermyCenterPX = this.posX+82;
                        var enermyCenterPY = this.posY+143;
                        var speedArray = getDirectSpeedXY(myPlane.PlaneX+myPlane.PlaneWidth/2, myPlane.PlaneY+myPlane.PlaneHeight/2, enermyCenterPX, enermyCenterPY, baseBulletSpeed);
                        initOneBullet(speedArray[0], speedArray[1], enermyCenterPX, enermyCenterPY, 0, this.bulletAttack);

                        enermyCenterPX = this.posX+218;
                        enermyCenterPY = this.posY+144;
                        speedArray = getDirectSpeedXY(myPlane.PlaneX+myPlane.PlaneWidth/2, myPlane.PlaneY+myPlane.PlaneHeight/2, enermyCenterPX, enermyCenterPY, baseBulletSpeed);
                        initOneBullet(speedArray[0], speedArray[1], enermyCenterPX, enermyCenterPY, 0, this.bulletAttack);
                        break;

                    case 1:
                        initOneBullet(-9.6, 2.5, this.posX+150, this.posY+220, 1, this.bulletAttack);
                        initOneBullet(-8.6, 5, this.posX+150, this.posY+220, 1, this.bulletAttack);
                        initOneBullet(-7, 7, this.posX+150, this.posY+220, 1, this.bulletAttack);
                        initOneBullet(-5, 8.6, this.posX+150, this.posY+220, 1, this.bulletAttack);
                        initOneBullet(-2.5, 9.6, this.posX+150, this.posY+220, 1, this.bulletAttack);
                        initOneBullet(0, 10, this.posX+150, this.posY+220, 1, this.bulletAttack);
                        initOneBullet(2.5, 9.6, this.posX+150, this.posY+220, 1, this.bulletAttack);
                        initOneBullet(5, 8.6, this.posX+150, this.posY+220, 1, this.bulletAttack);
                        initOneBullet(7, 7, this.posX+150, this.posY+220, 1, this.bulletAttack);
                        initOneBullet(8.6, 5, this.posX+150, this.posY+220, 1, this.bulletAttack);
                        initOneBullet(9.6, 2.5, this.posX+150, this.posY+220, 1, this.bulletAttack);
                        break;

                    case 2:
                        initOneBullet(0, baseBulletSpeed, this.posX+104, this.posY+157, 1, this.bulletAttack);
                        initOneBullet(0, baseBulletSpeed, this.posX+196, this.posY+157, 1, this.bulletAttack);
                        break;

                    case 3:
                        initOneBullet(0, baseBulletSpeed, this.posX+47, this.posY+60, 3, this.bulletAttack);
                        initOneBullet(0, baseBulletSpeed, this.posX+253, this.posY+60, 3, this.bulletAttack);
                        break;
                }
            }
            break;

        case 1:
            switch(bossLevel){
                case 1:
                    this.fightTotal = 15;
                    this.FightTypeTotal = 2;
                    break;

                case 2:
                    this.fightTotal = 10;
                    this.FightTypeTotal = 3;
                    break;

                case 3:
                default:
                    this.fightTotal = 6;
                    this.FightTypeTotal = 4;
                    break;
            }

            this.fightMethod = function(){
                switch(this.currentFightIndex){
                    case 0:
                        initOneBullet(0, baseBulletSpeed, this.posX+111, this.posY+this.width, 1, this.bulletAttack);
                        initOneBullet(0, baseBulletSpeed, this.posX+182, this.posY+this.width, 1, this.bulletAttack);
                        break;

                    case 1:
                        //直线型
                        var enermyCenterPX = this.posX+85
                        var enermyCenterPY = this.posY+173;
                        var speedArray = getDirectSpeedXY(myPlane.PlaneX+myPlane.PlaneWidth/2, myPlane.PlaneY+myPlane.PlaneHeight/2, enermyCenterPX, enermyCenterPY, baseBulletSpeed);
                        var baseSpeedX = speedArray[0];
                        var baseSpeedY = speedArray[1];
                        initOneBullet(baseSpeedX, baseSpeedY, enermyCenterPX, enermyCenterPY, 0, this.bulletAttack);
                        initOneBullet(1.1*baseSpeedX, 1.1*baseSpeedY, enermyCenterPX, enermyCenterPY, 0, this.bulletAttack);
                        initOneBullet(1.2*baseSpeedX, 1.2*baseSpeedY, enermyCenterPX, enermyCenterPY, 0, this.bulletAttack);
                        initOneBullet(1.3*baseSpeedX, 1.3*baseSpeedY, enermyCenterPX, enermyCenterPY, 0, this.bulletAttack);
                        initOneBullet(1.4*baseSpeedX, 1.4*baseSpeedY, enermyCenterPX, enermyCenterPY, 0, this.bulletAttack);

                        enermyCenterPX = this.posX+208
                        enermyCenterPY = this.posY+173;
                        speedArray = getDirectSpeedXY(myPlane.PlaneX+myPlane.PlaneWidth/2, myPlane.PlaneY+myPlane.PlaneHeight/2, enermyCenterPX, enermyCenterPY, baseBulletSpeed);
                        baseSpeedX = speedArray[0];
                        baseSpeedY = speedArray[1];
                        initOneBullet(baseSpeedX, baseSpeedY, enermyCenterPX, enermyCenterPY, 0, this.bulletAttack);
                        initOneBullet(1.1*baseSpeedX, 1.1*baseSpeedY, enermyCenterPX, enermyCenterPY, 0, this.bulletAttack);
                        initOneBullet(1.2*baseSpeedX, 1.2*baseSpeedY, enermyCenterPX, enermyCenterPY, 0, this.bulletAttack);
                        initOneBullet(1.3*baseSpeedX, 1.3*baseSpeedY, enermyCenterPX, enermyCenterPY, 0, this.bulletAttack);
                        initOneBullet(1.4*baseSpeedX, 1.4*baseSpeedY, enermyCenterPX, enermyCenterPY, 0, this.bulletAttack);
                        break;

                    case 2:
                        initOneBullet(0, baseBulletSpeed*2, this.posX+150, this.posY+130, 2, this.bulletAttack);
                        break;

                    case 3:
                        initOneBullet(0, baseBulletSpeed, this.posX+28, this.posY+83, 3, this.bulletAttack);
                        initOneBullet(0, baseBulletSpeed, this.posX+267, this.posY+83, 3, this.bulletAttack);
                        break;
                }
            }
            break;

        case 2:
            switch(bossLevel){
                case 1:
                    this.fightTotal = 10;
                    this.FightTypeTotal = 2;
                    break;

                case 2:
                default:
                    this.fightTotal = 6;
                    this.FightTypeTotal = 3;
                    break;
            }

            this.fightMethod = function(){
                switch(this.currentFightIndex){
                    case 0:
                        initOneBullet(0.7*baseBulletSpeed, 0.7*baseBulletSpeed, this.posX+128, this.posY+83, 1, this.bulletAttack);
                        initOneBullet(0.7*baseBulletSpeed, 0.7*baseBulletSpeed, this.posX+113, this.posY+99, 1, this.bulletAttack);
                        initOneBullet(-0.7*baseBulletSpeed, 0.7*baseBulletSpeed, this.posX+174, this.posY+85, 1, this.bulletAttack);
                        initOneBullet(-0.7*baseBulletSpeed, 0.7*baseBulletSpeed, this.posX+190, this.posY+99, 1, this.bulletAttack);
                        break;

                    case 1:
                        initOneBullet(0, baseBulletSpeed, this.posX+102, this.posY+158, 1, this.bulletAttack);
                        initOneBullet(0, baseBulletSpeed, this.posX+199, this.posY+158, 1, this.bulletAttack);

                        var enermyCenterPX = this.posX+88;
                        var enermyCenterPY = this.posY+150;
                        var speedArray = getDirectSpeedXY(myPlane.PlaneX+myPlane.PlaneWidth/2, myPlane.PlaneY+myPlane.PlaneHeight/2, enermyCenterPX, enermyCenterPY, baseBulletSpeed);
                        initOneBullet(speedArray[0], speedArray[1], enermyCenterPX, enermyCenterPY, 0, this.bulletAttack);

                        enermyCenterPX = this.posX+213;
                        enermyCenterPY = this.posY+150;
                        speedArray = getDirectSpeedXY(myPlane.PlaneX+myPlane.PlaneWidth/2, myPlane.PlaneY+myPlane.PlaneHeight/2, enermyCenterPX, enermyCenterPY, baseBulletSpeed);
                        initOneBullet(speedArray[0], speedArray[1], enermyCenterPX, enermyCenterPY, 0, this.bulletAttack);
                        break;

                    case 2:
                        initOneBullet(-9.6, 2.5, this.posX+150, this.posY+220, 1, this.bulletAttack);
                        initOneBullet(-8.6, 5, this.posX+150, this.posY+220, 1, this.bulletAttack);
                        initOneBullet(-7, 7, this.posX+150, this.posY+220, 1, this.bulletAttack);
                        initOneBullet(-5, 8.6, this.posX+150, this.posY+220, 1, this.bulletAttack);
                        initOneBullet(-2.5, 9.6, this.posX+150, this.posY+220, 1, this.bulletAttack);
                        initOneBullet(0, 10, this.posX+150, this.posY+220, 1, this.bulletAttack);
                        initOneBullet(2.5, 9.6, this.posX+150, this.posY+220, 1, this.bulletAttack);
                        initOneBullet(5, 8.6, this.posX+150, this.posY+220, 1, this.bulletAttack);
                        initOneBullet(7, 7, this.posX+150, this.posY+220, 1, this.bulletAttack);
                        initOneBullet(8.6, 5, this.posX+150, this.posY+220, 1, this.bulletAttack);
                        initOneBullet(9.6, 2.5, this.posX+150, this.posY+220, 1, this.bulletAttack);
                        break;
                }
            }
            break;

        case 3:
            switch(bossLevel){
                case 1:
                    this.fightTotal = 10;
                    this.FightTypeTotal = 2;
                    break;

                case 2:
                default:
                    this.fightTotal = 6;
                    this.FightTypeTotal = 3;
                    break;
            }

            this.fightMethod = function(){
                switch(this.currentFightIndex){
                    case 0:
                        initOneBullet(-9.6, 2.5, this.posX+72, this.posY+135, 1, this.bulletAttack);
                        initOneBullet(-8.6, 5, this.posX+72, this.posY+135, 1, this.bulletAttack);
                        initOneBullet(-7, 7, this.posX+72, this.posY+135, 1, this.bulletAttack);
                        initOneBullet(-5, 8.6, this.posX+72, this.posY+135, 1, this.bulletAttack);
                        initOneBullet(-2.5, 9.6, this.posX+72, this.posY+135, 1, this.bulletAttack);
                        initOneBullet(0, 10, this.posX+72, this.posY+135, 1, this.bulletAttack);
                        initOneBullet(2.5, 9.6, this.posX+72, this.posY+135, 1, this.bulletAttack);
                        initOneBullet(5, 8.6, this.posX+72, this.posY+135, 1, this.bulletAttack);
                        initOneBullet(7, 7, this.posX+72, this.posY+135, 1, this.bulletAttack);
                        initOneBullet(8.6, 5, this.posX+72, this.posY+135, 1, this.bulletAttack);
                        initOneBullet(9.6, 2.5, this.posX+72, this.posY+135, 1, this.bulletAttack);

                        initOneBullet(-9.6, 2.5, this.posX+223, this.posY+135, 1, this.bulletAttack);
                        initOneBullet(-8.6, 5, this.posX+223, this.posY+135, 1, this.bulletAttack);
                        initOneBullet(-7, 7, this.posX+223, this.posY+135, 1, this.bulletAttack);
                        initOneBullet(-5, 8.6, this.posX+223, this.posY+135, 1, this.bulletAttack);
                        initOneBullet(-2.5, 9.6, this.posX+223, this.posY+135, 1, this.bulletAttack);
                        initOneBullet(0, 10, this.posX+223, this.posY+135, 1, this.bulletAttack);
                        initOneBullet(2.5, 9.6, this.posX+223, this.posY+135, 1, this.bulletAttack);
                        initOneBullet(5, 8.6, this.posX+223, this.posY+135, 1, this.bulletAttack);
                        initOneBullet(7, 7, this.posX+223, this.posY+135, 1, this.bulletAttack);
                        initOneBullet(8.6, 5, this.posX+223, this.posY+135, 1, this.bulletAttack);
                        initOneBullet(9.6, 2.5, this.posX+223, this.posY+135, 1, this.bulletAttack);
                        break;

                    case 1:
                        initOneBullet(0, baseBulletSpeed, this.posX+132, this.posY+189, 1, this.bulletAttack);
                        initOneBullet(0, baseBulletSpeed, this.posX+164, this.posY+189, 1, this.bulletAttack);
                        break;

                    case 2:
                        initOneBullet(-9.6, 2.5, this.posX+120, this.posY+167, 1, this.bulletAttack);
                        initOneBullet(-8.6, 5, this.posX+120, this.posY+167, 1, this.bulletAttack);
                        initOneBullet(-7, 7, this.posX+120, this.posY+167, 1, this.bulletAttack);
                        initOneBullet(-5, 8.6, this.posX+120, this.posY+167, 1, this.bulletAttack);
                        initOneBullet(-2.5, 9.6, this.posX+120, this.posY+167, 1, this.bulletAttack);
                        initOneBullet(0, 10, this.posX+120, this.posY+167, 1, this.bulletAttack);
                        initOneBullet(2.5, 9.6, this.posX+120, this.posY+167, 1, this.bulletAttack);
                        initOneBullet(5, 8.6, this.posX+120, this.posY+167, 1, this.bulletAttack);
                        initOneBullet(7, 7, this.posX+120, this.posY+167, 1, this.bulletAttack);
                        initOneBullet(8.6, 5, this.posX+120, this.posY+167, 1, this.bulletAttack);
                        initOneBullet(9.6, 2.5, this.posX+120, this.posY+167, 1, this.bulletAttack);

                        initOneBullet(-9.6, 2.5, this.posX+176, this.posY+167, 1, this.bulletAttack);
                        initOneBullet(-8.6, 5, this.posX+176, this.posY+167, 1, this.bulletAttack);
                        initOneBullet(-7, 7, this.posX+176, this.posY+167, 1, this.bulletAttack);
                        initOneBullet(-5, 8.6, this.posX+176, this.posY+167, 1, this.bulletAttack);
                        initOneBullet(-2.5, 9.6, this.posX+176, this.posY+167, 1, this.bulletAttack);
                        initOneBullet(0, 10, this.posX+176, this.posY+167, 1, this.bulletAttack);
                        initOneBullet(2.5, 9.6, this.posX+176, this.posY+167, 1, this.bulletAttack);
                        initOneBullet(5, 8.6, this.posX+176, this.posY+167, 1, this.bulletAttack);
                        initOneBullet(7, 7, this.posX+176, this.posY+167, 1, this.bulletAttack);
                        initOneBullet(8.6, 5, this.posX+176, this.posY+167, 1, this.bulletAttack);
                        initOneBullet(9.6, 2.5, this.posX+176, this.posY+167, 1, this.bulletAttack);
                        break;
                }
            }
            break;
    }
};
EnermyFly_Boss1.prototype.update = function(){
    if(this.usable){
        if(this.hasArriveTarget){
            this.moveMethod();
        }
        else{
            //更新位置
            this.lastPosX = this.posX;
            this.lastPosY = this.posY;
            this.posX = this.posX + this.speedX;
            this.posY = this.posY + this.speedY;
            if(this.lastPosY <= this.MapTop && this.posY >= this.MapTop){
                this.visible = true;
            }
            if(this.lastPosY > this.MapBottom && this.posY > this.MapBottom){
                this.usable = false;
                this.visible = false;
            }

            if(this.visible){
                if(this.posY>=this.targetY){
                    this.hasArriveTarget = true;
                    this.startFight = true;
                }
            }
        }

        //血量显示
        this.checkShowBlood();

        //攻击方式
        if(this.startFight){
            this.fightCount++;
            if(this.fightCount ==  this.fightTotal){
                this.fightCount = 0;

                this.fightMethod();
                this.currentFightIndex++;
                if(this.currentFightIndex >= this.FightTypeTotal){
                    this.currentFightIndex = 0;
                }
            }
        }
    }
}